Skip to content

fix(middleware): keep handler 404 responses with Static HTML5 mode#2984

Closed
leno23 wants to merge 1 commit into
labstack:v4from
leno23:fix/static-html5-handler-404
Closed

fix(middleware): keep handler 404 responses with Static HTML5 mode#2984
leno23 wants to merge 1 commit into
labstack:v4from
leno23:fix/static-html5-handler-404

Conversation

@leno23

@leno23 leno23 commented May 25, 2026

Copy link
Copy Markdown

Summary

  • Restrict Static middleware HTML5 SPA fallback to router-level 404 responses
  • Skip index.html fallback when a matched handler returns its own 404 (e.g. API resource not found)
  • Add regression test covering /api/test/3 JSON 404 vs /client-route SPA index fallback

Test plan

  • go test ./middleware/...
  • TestStaticHTML5DoesNotOverrideHandler404

Fixes #2775

HTML5 fallback to index.html should apply only to router-level 404s,
not to 404 errors returned by matched API handlers behind the static
middleware.

Fixes labstack#2775

Co-authored-by: Cursor <cursoragent@cursor.com>
@aldas

aldas commented May 25, 2026

Copy link
Copy Markdown
Contributor

Could you explain what use-case/issue this is solving?

@aldas

aldas commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Closing, this PR is against v4 branch and we do not accept new features in v4, only security and bug related changes are accepted.

@aldas aldas closed this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants